class CreateCourses < ActiveRecord::Migration
  def self.up
    create_table(:courses, {:force => true, :options => 'ENGINE=InnoDB DEFAULT CHARSET=utf8'}) do |t|
      t.column :user_id,                  :integer, :null => false
      t.column :category_id,              :integer, :null => false
      t.column :title,                    :string, :default => "", :null => false
      t.column :description,              :string, :default => "", :null => false
      t.column :is_freeze,                :integer, :default => 0
      t.column :is_public,                :integer, :default => 0
      t.column :items_count,              :integer, :default => 0
      t.column :user_courses_count,       :integer, :default => 0

      t.timestamps
    end
  end

  def self.down
    drop_table :courses
  end
end
